Skip to content

gh-133510: Add links to more info for the match statement#133511

Merged
StanFromIreland merged 10 commits into
python:mainfrom
xzkdeng:main
Jun 30, 2026
Merged

gh-133510: Add links to more info for the match statement#133511
StanFromIreland merged 10 commits into
python:mainfrom
xzkdeng:main

Conversation

@xzkdeng

@xzkdeng xzkdeng commented May 6, 2025

Copy link
Copy Markdown
Contributor

Add example of the match statement in the FAQ "Why isn't there a switch or case statement in Python?", and links to PEP 634,PEP 636 for details.


📚 Documentation preview 📚: https://cpython-previews--133511.org.readthedocs.build/

Add example of the ``match`` statement in the FAQ "Why isn't there a switch or case statement in Python?", and links to PEP 634,PEP 636 for details.
@python-cla-bot

python-cla-bot Bot commented May 6, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

Comment thread Doc/faq/design.rst Outdated
Comment thread Doc/faq/design.rst Outdated
Comment thread Doc/faq/design.rst Outdated
@xzkdeng xzkdeng changed the title gh-133510: Add example for the match statement gh-133510: Add links to more info for the match statement May 6, 2025
Comment thread Doc/faq/design.rst Outdated
Comment thread Doc/faq/design.rst Outdated
Comment thread Doc/faq/design.rst Outdated

Since Python 3.10 one can easily match literal values, or constants
within a namespace, with a ``match ... case`` statement.
See :pep:`634` (specification) and :pep:`636` (tutorial) for details about the ``match`` statement.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the "(tutorial)" it is probably best to replace the link with a link to the actual tutorial page that covers this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The PEPs are historical documents that typically become stale over time. I think that there shouldn't be a link to a PEP for either the specification or tutorial.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we should add an 'outdated' note in PEP 636, like the one in PEP 634.

Co-authored-by: sobolevn <mail@sobolevn.me>
Comment thread Doc/faq/design.rst Outdated

Since Python 3.10 one can easily match literal values, or constants
within a namespace, with a ``match ... case`` statement.
See :pep:`634` (specification) and :pep:`636` (tutorial) for details about

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link to the documentation too here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean adding a link to this?

@bedevere-app

bedevere-app Bot commented May 7, 2025

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

xzkdeng and others added 2 commits May 9, 2025 18:51
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Changed the links to link to more up-to-date documentation.
@xzkdeng

xzkdeng commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again
Suggestions are welcomed!

@bedevere-app

bedevere-app Bot commented May 9, 2025

Copy link
Copy Markdown

Thanks for making the requested changes!

@AA-Turner: please review the changes made to this pull request.

@bedevere-app bedevere-app Bot requested a review from AA-Turner May 9, 2025 11:15
@xzkdeng

xzkdeng commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Accidentally clicked the "close with comment" button.

Comment thread Doc/faq/design.rst Outdated
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 24, 2026
Comment thread Doc/faq/design.rst Outdated
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33355690 | 📁 Comparing d3ca02d against main (0cbac06)

  🔍 Preview build  

1 file changed
± faq/design.html

@StanFromIreland StanFromIreland merged commit 7718157 into python:main Jun 30, 2026
33 of 34 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 30, 2026
@StanFromIreland StanFromIreland added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 30, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @xzkdeng for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @xzkdeng for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @xzkdeng for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 30, 2026

Copy link
Copy Markdown

GH-152654 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 30, 2026
@bedevere-app

bedevere-app Bot commented Jun 30, 2026

Copy link
Copy Markdown

GH-152655 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 30, 2026
@bedevere-app

bedevere-app Bot commented Jun 30, 2026

Copy link
Copy Markdown

GH-152656 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 30, 2026
StanFromIreland added a commit that referenced this pull request Jun 30, 2026
…AQ anwser (GH-133511) (#152654)

(cherry picked from commit 7718157)

Co-authored-by: xzkdeng <xzkdeng@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
StanFromIreland added a commit that referenced this pull request Jun 30, 2026
…AQ anwser (GH-133511) (#152655)

(cherry picked from commit 7718157)

Co-authored-by: xzkdeng <xzkdeng@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
StanFromIreland added a commit that referenced this pull request Jun 30, 2026
…AQ anwser (GH-133511) (#152656)

(cherry picked from commit 7718157)

Co-authored-by: xzkdeng <xzkdeng@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants